package com.library.lms.vo;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResultVo<T> implements Serializable {
    /**
     * 代码
     */
    private String code;
    /**
     * 返回信息
     */
    private String message;
    /**
     * 是否成功
     */
    private Boolean success;
    /**
     * 数据
     */
    private T data;

    public ResultVo(T data) {
        this.data = data;
    }

    public ResultVo<T> success() {
        this.code = "200";
        this.message = "success";
        return this;
    }
    public ResultVo<T> error() {
        this.code = "400";
        this.message = "error";
        return this;
    }

}
